package com.sourcetrip.my.modle;

import java.util.LinkedList;
import java.util.List;

/**
 * @author: xiaomi
 * @date: 2021/1/17
 * @description:    路径信息（图论相关）
 */
public class PathInfo<V, E> {
    protected E weight;
    protected List<EdgeInfo<V, E>> edgeInfos = new LinkedList<>();

    public PathInfo() {
    }

    public PathInfo(E weight) {
        this.weight = weight;
    }

    public PathInfo(E weight, List<EdgeInfo<V, E>> edgeInfos) {
        this.weight = weight;
        this.edgeInfos = edgeInfos;
    }

    public E getWeight() {
        return weight;
    }

    public void setWeight(E weight) {
        this.weight = weight;
    }

    public List<EdgeInfo<V, E>> getEdgeInfos() {
        return edgeInfos;
    }

    public void setEdgeInfos(List<EdgeInfo<V, E>> edgeInfos) {
        this.edgeInfos = edgeInfos;
    }

    /**
     * 增加一条 边的信息
     * @param edgeInfo
     */
    public void addEdgeInfo(EdgeInfo<V, E> edgeInfo){
        edgeInfos.add(edgeInfo);
    }

    @Override
    public String toString() {
        return "PathInfo [weight=" + weight + ", edgeInfos=" + edgeInfos + "]";
    }
}
